package com.example.workbench.common.emus;

import cn.hutool.core.util.PinyinUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum BusinessError implements BaseEnum {
    VALID_DATA_ERROR(10000,null),
    USER_ADD_ERROR(10001,"用户添加失败"),
    USER_NAME_EXIST(10002,"该用户名已存在，请重新输入！"),
    USER_NAME_NOT_EXIST(10003,"该用户名不存在！"),
    USER_PASSWORD_ERROR(10004,"密码输入错误，请重新输入"),
    USER_NOT_AUTH(10005,"用户无权访问"),
    FOOD_IS_EXIST(10006,"该美食已存在!");
    private Integer code;

    private String desc;

    @Override
    public Integer getNumber() {
        return getCode();
    }

    @Override
    public String getName() {
        return getDesc();
    }

    @Override
    public String getSimplePinYin() {
        return PinyinUtil.getAllFirstLetter(getDesc());
    }

    @Override
    public String getFullPinYin() {
        return PinyinUtil.getPinYin(getDesc());
    }

}
